<?php

class CC_Helpdesk_Action_Folder extends CC_Helpdesk_Action_Abstract
{
    public function parse()
    {
        if(!isset($this->_params['folder']))
            throw new Zend_Exception('No folder specified');
            
        $folder = $this->_em->getReference('CC\Entity\Folder', $this->_params['folder']);
        
        if($folder !== null)
        {
            $this->_ticket->setFolder($folder);
            $this->_em->persist($this->_ticket);
            $this->_em->flush();
            
            return true;
        }
        else
        {
            throw new Zend_Exception('Invalid folder specified');
        }
    }
}
?>